<?php

namespace Simanin\BackdoorBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Simanin\BackdoorBundle\Entity\Users;
use Simanin\BackdoorBundle\Entity\UserProfile;

class DefaultController extends Controller
{
    
    /**
     * @Route("/sdemo")
     * @Template()
     */
    public function indexAction()
    {
		 /*
		 $user = new User();
		 $user->setFirstName('A Foo Bar');
		 $user->setLastName('last name');
		 $user->setEmail('Email gere');
*/
		$user = $this->getDoctrine()
        ->getRepository('SimaninBackdoorBundle:Users')
        ->find(1);
		
		$profile = new UserProfile();
		$profile->setUser($user);
		$profile->setPhone('12121');
//echo '<xmp>'.print_r($product, 1).'</xmp>';exit;

		 $em = $this->getDoctrine()->getEntityManager();
		 $em->persist($profile);
		 $em->flush();
		 echo 'sa'; exit;
        return array();
    }

    /**
     * @Route("/hello/{name}", name="_demo_hello")
     * @Template()
     
    public function indexAction($name)
    {
        return array('name' => $name);
    }
     * 
     */
}
